package ebcs.database.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ebcs.database.bean.BsCapacityAll;
import ebcs.database.bean.BsCapacityDstbt;
import ebcs.database.bean.BsNeedInfor;
import ebcs.database.mybatis.dao.BsCapacityDstbtMapper;
import ebcs.database.service.BsCapacityDstbtServiceImp;

@Service
public class BsCapacityDstbtServiceImpl implements BsCapacityDstbtServiceImp {
	@Autowired
	private BsCapacityDstbtMapper capacityDao ;
	
	@Override
	public List<BsCapacityAll> selectCapacityAll(String needId) {
		BsNeedInfor bean = new BsNeedInfor();
		bean.setRouid(needId);
 		return capacityDao.selectCapacityAll(bean);
	}

	@Override
	public List<BsCapacityDstbt> selectCapacityDstbt(String needId) {
		BsNeedInfor bean = new BsNeedInfor();
		bean.setRouid(needId);
		return capacityDao.selectCapacityDstbt(bean);
	}

	@Override
	public int insertCapInfor(BsCapacityDstbt bean) {
 		return capacityDao.insertCapInfor(bean);
	}

	@Override
	public int updateCapInfor(BsCapacityDstbt bean) {
 		return this.capacityDao.updateCapInfor(bean);
	}

	@Override
	public int deleteCapInfor(BsCapacityDstbt bean) {
 		return this.capacityDao.deleteCapInfor(bean);
	}

	@Override
	public List<BsCapacityDstbt> selectCapacityPerson(BsCapacityDstbt bean) {
		return this.capacityDao.selectCapacityPerson(bean);
	}

	@Override
	public BsCapacityDstbt selectCapacityById(BsCapacityDstbt bean) {
		return this.capacityDao.selectCapacityById(bean);
	}

	@Override
	public int selectUserFreeze(String userNo,String month) {
		BsCapacityDstbt bean = new BsCapacityDstbt();
		bean.setFreezeData("1");	
		bean.setCapacityMonth(month);
		bean.setUserNo(userNo);
		return this.capacityDao.selectUserFreeze(bean).size();
	}

}
